﻿using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;

namespace Services {
    public class DisplayObject : DynamicObject {
        public string EmpName {
            get;
            set;
        }
        public string TotalHour {
            get;
            set;
        }
        public string TotalWork {
            get;
            set;
        }

        Dictionary<string, object> _DynamicProperties = new Dictionary<string, object>();

        public Dictionary<string, object> DynamicProperties {
            get {
                return _DynamicProperties;
            } 
        }
         
        public override bool TrySetMember(SetMemberBinder binder, object value) {
            if (!_DynamicProperties.Keys.Contains(binder.Name)) { 
                _DynamicProperties.Add(binder.Name, value.ToString());
            }
            return true;
        }

        public override bool TryGetMember(GetMemberBinder binder, out object result) {
            return _DynamicProperties.TryGetValue(binder.Name, out result);
        }

        List<Object> _SubData;

        public List<Object> SubData {
            get {
                return _SubData;
            } 
        }
    }
}
